# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ReaderRevenueSubscriptionLinking.V1.Model.Entitlement do
  @moduledoc """
  A single entitlement for a publication reader

  ## Attributes

  *   `detail` (*type:* `String.t`, *default:* `nil`) - The detail field can carry a description of the SKU that corresponds to what the user has been granted access to. This description, which is opaque to Google, can be displayed in the Google user subscription console for users who linked the subscription to a Google Account. Max 80 character limit.
  *   `expireTime` (*type:* `DateTime.t`, *default:* `nil`) - Required. Expiration time of the entitlement. Entitlements that have expired over 30 days will be purged. The max expire_time is 398 days from now().
  *   `productId` (*type:* `String.t`, *default:* `nil`) - Required. The publication's product ID that the user has access to. This is the same product ID as can be found in Schema.org markup (http://schema.org/productID). E.g. "dailybugle.com:basic"
  *   `subscriptionToken` (*type:* `String.t`, *default:* `nil`) - A source-specific subscription token. This is an opaque string that the publisher provides to Google. This token is opaque and has no meaning to Google.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :detail => String.t() | nil,
          :expireTime => DateTime.t() | nil,
          :productId => String.t() | nil,
          :subscriptionToken => String.t() | nil
        }

  field(:detail)
  field(:expireTime, as: DateTime)
  field(:productId)
  field(:subscriptionToken)
end

defimpl Poison.Decoder, for: GoogleApi.ReaderRevenueSubscriptionLinking.V1.Model.Entitlement do
  def decode(value, options) do
    GoogleApi.ReaderRevenueSubscriptionLinking.V1.Model.Entitlement.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ReaderRevenueSubscriptionLinking.V1.Model.Entitlement do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
